package com.example.pclimb.ui.requests;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.adapter.FragmentStateAdapter;

/**
 * 陪爬申请页面的ViewPager适配器
 */
public class RequestPagerAdapter extends FragmentStateAdapter {

    public RequestPagerAdapter(@NonNull Fragment fragment) {
        super(fragment);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        // 根据位置返回不同的Fragment
        switch (position) {
            case 0:
                return new PendingRequestsFragment(); // 待匹配申请
            case 1:
                return new MatchedRequestsFragment(); // 已匹配申请
            case 2:
                return new AwaitingPaymentRequestsFragment(); // 待支付申请
            case 3:
                return new CompletedRequestsFragment(); // 已完成申请
            case 4:
                return new CancelledRequestsFragment(); // 已取消申请
            default:
                return new PendingRequestsFragment();
        }
    }

    @Override
    public int getItemCount() {
        return 5; // 5个标签页：待匹配、已匹配、待支付、已完成、已取消
    }
} 